package com.fdb.efp.nls.api.rest;

import com.fdb.basic.framework.core.constant.ResponseData;
import com.fdb.basic.framework.web.controller.AbstractController;
import com.fdb.efp.nls.service.bo.ImageQueueTaskVO;
import com.fdb.efp.nls.service.facade.ImageQueueTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class ImageQueueTaskController extends AbstractController {

	@Autowired
	@Qualifier("imageQueueTaskService")
	private ImageQueueTaskService imageQueueTaskService;

	/**
	 * 列表数据查询
	 * 
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value = "/image/queue/tasks", method = RequestMethod.POST)
	public @ResponseBody
    ResponseData<List<ImageQueueTaskVO>> queryImageQueueTaskAll(@RequestBody ImageQueueTaskVO vo) {
		// this.executeQueryList("queryAll", imageQueueTaskService, new Object[]{vo});
		List<ImageQueueTaskVO> outputVo = imageQueueTaskService.queryAllOwner(vo);
		return getResponseData(outputVo);

	}

	/**
	 * 根据主键查询详情
	 * 
	 * @return
	 */
	@RequestMapping(value = "/image/queue/task/{applySeq}", method = RequestMethod.GET)
	public @ResponseBody
    ResponseData<ImageQueueTaskVO> queryByPk(@PathVariable("applySeq") String applySeq) {
		ImageQueueTaskVO inVo = new ImageQueueTaskVO();
		inVo.setApplySeq(applySeq);
		ImageQueueTaskVO outputVo = imageQueueTaskService.queryByPk(inVo);
		return getResponseData(outputVo);

	}

	/**
	 * 根据主键删除信息
	 * 
	 * @param imageQueueTask
	 * @return
	 */
	@RequestMapping(value = "/image/queue/task", method = RequestMethod.DELETE)
	public @ResponseBody
    ResponseData<Integer> deleteByPk(@RequestBody ImageQueueTaskVO inImageQueueTaskVo) {
		int outputVo = imageQueueTaskService.deleteByPk(inImageQueueTaskVo);
		return getResponseData(outputVo);

	}

	/**
	 * 根据主键更新信息
	 * 
	 * @param inImageQueueTaskVo
	 * @return
	 */
	@RequestMapping(value = "/image/queue/task", method = RequestMethod.PUT)
	public @ResponseBody
    ResponseData<Integer> updateByPk(@RequestBody ImageQueueTaskVO inImageQueueTaskVo) {
		int outputVo = imageQueueTaskService.updateByPk(inImageQueueTaskVo);
		return getResponseData(outputVo);

	}

	/**
	 * 新增数据
	 * 
	 * @param inImageQueueTaskVo
	 * @return
	 */
	@RequestMapping(value = "/image/queue/task", method = RequestMethod.POST)
	public @ResponseBody
    ResponseData<Integer> insertImageQueueTask(@RequestBody ImageQueueTaskVO inImageQueueTaskVo) {
		int outputVo = imageQueueTaskService.insertImageQueueTask(inImageQueueTaskVo);
		return getResponseData(outputVo);

	}
}
